/*
 * Copyright 2013 Sigurd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package de.digiway.rapidbreeze.shared.rest.config;

import java.nio.file.Path;

/**
 *
 * @author Sigurd
 */
public interface CommonServerConfiguration {

    public static final String PROP_DOWNLOAD_TARGET_FOLDER = "Download_TargetFolder";
    public static final String PROP_DOWNLOAD_SPEED = "Download_Speed";
    public static final String PROP_DOWNLOAD_PARALLEL_PAUSE = "DownloadParallelPause";
    public static final String PROP_DOWNLOAD_PARALLEL_SLOW = "DownloadParallelSlow";
    public static final String PROP_DOWNLOAD_PARALLEL_NORMAL = "DownloadParallelNormal";
    public static final String PROP_DOWNLOAD_PARALLEL_FAST = "DownloadParallelFast";
    public static final String PROP_DOWNLOAD_SPEED_PAUSE = "DownloadSpeedPause";
    public static final String PROP_DOWNLOAD_SPEED_SLOW = "DownloadSpeedSlow";
    public static final String PROP_DOWNLOAD_SPEED_NORMAL = "DownloadSpeedNormal";
    public static final String PROP_DOWNLOAD_SPEED_FAST = "DownloadSpeedFast";

    /**
     * Returns the {@linkplain Path} to the download folder where downloads are
     * persisted to.
     *
     * @return
     */
    public Path getDownloadTargetFolder();

    /**
     * Sets the {@linkplain Path} where downloads are persisted to.
     *
     * @param folder
     */
    public void setDownloadTargetFolder(Path folder);

    /**
     * Sets the overall download speed state.
     *
     * @param speed
     */
    public void setDownloadSpeed(DownloadSpeed speed);

    /**
     * Gets the overall download speed state.
     *
     * @return
     */
    public DownloadSpeed getDownloadSpeed();

    /**
     * Returns the number of possible parallel downloads in the given speed
     * state.
     *
     * @param downloadSpeed
     * @return
     */
    public Integer getParallelDownloads(DownloadSpeed downloadSpeed);

    /**
     * Sets the number of possible parallel downloads for the given speed state.
     *
     * @param downloadSpeed
     * @param parallel
     */
    public void setParallelDownloads(DownloadSpeed downloadSpeed, int parallel);

    /**
     * Sets the overall download speed to the given kilobytes per second for the
     * given download state.
     *
     * @param downloadSpeed
     * @param kb
     */
    public void setKbPerSecond(DownloadSpeed downloadSpeed, int kb);

    /**
     * Returns the overall download speed for the given speed state in kilobytes
     * per second.
     *
     * @param downloadSpeed
     * @return
     */
    public int getKbPerSecond(DownloadSpeed downloadSpeed);
}
